home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15719 < prev    next >
Encoding:
Text File  |  1996-08-05  |  973 b   |  26 lines

  1. Newsgroups: comp.lang.c
  2. Path: netcom.com!smryan
  3. From: smryan@netcom.com (@#$%!?!)
  4. Subject: Re: Array initialization problem
  5. Message-ID: <smryanDq6L6v.Hs3@netcom.com>
  6. Organization: The Programmer formerly known as S M Ryan
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. References: <4laukj$q4t@newsbf02.news.aol.com>
  9. Date: Sat, 20 Apr 1996 22:01:43 GMT
  10. Sender: smryan@netcom4.netcom.com
  11.  
  12. : void make_matrix(int size)
  13. : {
  14. :     int arr[size];  /* This is where compiler complains that size has to
  15. : be a constant
  16. :                            I tried casting but it did not help. */
  17. : }
  18.  
  19. In general, for computable array bounds, use malloc,
  20.     int *arr = malloc(size*sizeof(int));
  21. -- 
  22. The Queen who loves, the Queen of life,    | smryan@netcom.com  PO Box 1563
  23. the Queen who straits, the Queen of strife;|          Cupertino, California
  24. with gasp of death or gift of breath       | (xxx)xxx-xxxx            95015
  25. she brings the choice of birth or knife.   |         I don't use no smileys
  26.